/******
 * 通过获取消息队列，来显示消息
 * 
 * 
 * 
 */
var $mqQueue=[]; 
var Index = function () { 

    return {

        //main function to initiate the module
        init: function () { 
        	$mqQueue = ${msgQueue};
        }, 

        initIntro: function () {  
        	mqQueue.forEach(function(mq){
        	    console.log(mq);
        	    if(mq != null){
        	           setTimeout(function () {
        	                var unique_id = $.gritter.add({
        	                	postion: mq.postion,
        	                    // (string | mandatory) the heading of the notification
        	                    title: mq.title,
        	                    // (string | mandatory) the text inside the notification
        	                    text: mq.text,
        	                    // (string | optional) the image to display on the left
        	                    image: mq.image,
        	                    // (bool | optional) if you want it to fade out on its own or just sit there
        	                    sticky: true,
        	                    // (int | optional) the time you want it to be alive for before fading out
        	                    time: '',
        	                    // (string | optional) the class name you want to apply to that specific message
        	                    class_name: 'my-sticky-class'
        	                });

        	                // You can have it return a unique id, this can be used to manually remove it later using
        	                setTimeout(function () {
        	                    $.gritter.remove(unique_id, {
        	                        fade: true,
        	                        speed: 'slow'
        	                    });
        	                }, 12000);
        	            }, 2000); 
        	    	
        	    	}
        	    
        	});
        }
    };

}();